home *** CD-ROM | disk | FTP | other *** search
- PROGRAM Count(input,output,picfile);
-
- { Copyright (c) 1987, Ciarcia's Circuit Cellar }
- { All Rights Reserved }
-
- {$U- control-break checking during execution }
- {$C- control-break checking during I/O operations }
- {$R- array range checking }
-
- {$Ideclares.p declarations }
- {$Ihexutil.p hex utilities }
- {$Iserial.p serial interface code }
- {$Ipictures.p picture file code }
- {$Iimages.p image processing }
-
- VAR
- level : INTEGER;
- valerror : INTEGER;
- npels : REAL;
- retval : INTEGER;
-
- BEGIN
-
- LowVideo;
-
- pic1 := NIL; { ensure new alloc }
- PicSetup(pic1); { set up picture array }
-
- filespec := GetFSpec(ParamStr(1));
-
- LoadPicture(filespec,pic1);
-
- IF Length(ParamStr(2)) = 0
- THEN BEGIN
- Write('Pel level (0-63): ');
- Readln(level);
- IF level > 63
- THEN level := 63;
- IF level < 0
- THEN level := 0;
- valerror := 0;
- END
- ELSE Val(ParamStr(2),level,valerror);
-
- IF valerror <> 0
- THEN BEGIN
- Writeln('Level must be numeric: ',ParamStr(2));
- Halt;
- END;
-
- Writeln('Counting...');
- npels := CountPels(pic1,level);
-
- Writeln(npels:8:0,' pels >= ',level,' brightness');
-
- retval := Trunc(npels/100.0);
-
- IF retval > 255
- THEN Halt(255)
- ELSE Halt(retval);
-
- END.